#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <string.h>

int main(){
  //system call
  umask(0);
  int fd=open("log.txt",O_WRONLY | O_CREAT | O_TRUNC,0666);
  if(fd<0){
    perror("open");
    return 1;
  }
  const char *message="hello,linux!!!\n";
  write(fd,message,strlen(message));
  close(fd); 
  return 0;
}
